package com.hz.us.mapper;

import com.hz.us.model.entity.ClassEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClassMapper {

    @Select("select * from classes where grade_id = #{gradeId}")
    List<ClassEntity> gradeClasses(@Param("grade_id") Integer gradeId);

    @Insert("insert into classes values (null, #{class_name}, #{grade_id}, #{grade_name}, #{grade_year})")
    int addClass(ClassEntity classEntity);

    @Delete("delete from classes where id = #{classId}")
    int delClass(@Param("id") Integer classId);

    @Select("select * from classes where class_name = #{className}")
    ClassEntity selectByName(@Param("className") String className);

    @Select("select * from classes where id = #{id}")
    ClassEntity selectById(@Param("id") Integer id);

}
